﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace MoneyWentWhere.Utils.Storage
{
    public interface IDataFormat<DocT> 
        where DocT : class, IHasStorageInfo
    {
        /// <summary>
        /// Load the document from the file, given the optional password.
        /// </summary>
        /// <param name="filename"></param>
        /// <param name="password"></param>
        /// <throws>InvalidPasswordException</throws>
        /// <throws>InvalidDataException</throws>
        /// <returns></returns>
        DocT Load(Stream inStream, String password = null);

        /// <summary>
        /// Save the document to the file.
        /// </summary>
        /// <param name="document"></param>
        void Save(DocT document, Stream outStream);
    }
}
